﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="OAclient.Common" %>

<script type="text/javascript">
    $(function() {
        $(".datepicker").datepicker();

        tableSelectOrder("#wfcurdelegtasklist .table_style");
    });

</script>

<script type="text/javascript">
    $(function() {
        var curdeleftasklistoptions = {
            url: "/WorkFlow/WFCurDelegTaskList",
            type: "POST",
            success: function(data) {
                $("#workarea-2-7").html(data);
            }
        };

        $("#frmcurdeleftasklist").ajaxForm(curdeleftasklistoptions);
    })

    // 代为审批
    function curtaskhelperapproval(uniqueid, task_id, ptask_id, str_id) {
        $.ajax({
            type: "POST",
            url: "/WorkFlow/WFProcess",
            data: { "uniqueid": uniqueid, "task_id": task_id, "ptask_id": ptask_id, "str_id": str_id },
            success: function(data) {
                addtab('2-2-examine', '委托审批');
                $("#workarea-2-2-examine").html(data);
            }
        })
    }
</script>

<div id="wfcurdelegtasklistlist" style="padding-top: 35px;">
    <%using (Html.BeginForm("WFCurDelegTaskList", "WorkFlow", FormMethod.Post, new { id = "frmcurdeleftasklist" }))
      {%>
    <div class="selectpanel" style="margin: 5px 20px 5px 70px;">
        审批单名称:
        <%=Html.DropDownList("searchwfname_wfcurdelegtasklist", ViewData["wfnamelist"] as List<SelectListItem>, "======请选择======", null)%>
        时间:
        <%=Html.TextBox("searchstime_wfcurdelegtasklist", "", new { @class = "datepicker" })%>
        -
        <%=Html.TextBox("searchetime_wfcurdelegtasklist", "", new { @class = "datepicker" })%>
        <input class="btn_style" type="submit" value="查询" name="submit" />
    </div>
    <div>
        <table border="0" width="100%" class="table_style" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th class="th_long">
                        审批单名称
                    </th>
                    <th class="th_short">
                        申请人
                    </th>
                    <th class="th_middle">
                        部门
                    </th>
                    <th class="th_middle">
                        委托人
                    </th>
                    <th class="th_middle">
                        部门
                    </th>
                    <th class="th_middle">
                        委托到达时间
                    </th>
                    <th>
                    </th>
                    <th class="th_middle">
                    </th>
                </tr>
            </thead>
            <tbody>
                <%
                    System.Data.DataTable dt_delegtask = ViewData["dt_delegtask"] as System.Data.DataTable;
                    if (dt_delegtask != null && dt_delegtask.Rows.Count > 0)
                    {
                        for (int i = 0; i < (dt_delegtask.Rows.Count > 10 ? 10 : dt_delegtask.Rows.Count); i++)
                        {
                %>
                <tr>
                    <td>
                        <%=dt_delegtask.Rows[i]["流程名称"]%>
                    </td>
                    <td>
                        <%=dt_delegtask.Rows[i]["发起人"]%>
                    </td>
                    <td>
                        <%=dt_delegtask.Rows[i]["部门1"]%>
                    </td>
                    <td>
                        <%=dt_delegtask.Rows[i]["委托人"]%>
                    </td>
                    <td>
                        <%=dt_delegtask.Rows[i]["部门2"]%>
                    </td>
                    <td>
                        <%=DateTime.Parse(dt_delegtask.Rows[i]["开始时间"].ToString()).ToString("yyyy-MM-dd HH:mm")%>
                    </td>
                    <td>
                    </td>
                    <td>
                        <a class="approve" onclick="curtaskhelperapproval('<%=dt_delegtask.Rows[i]["实例标识"] %>','<%=dt_delegtask.Rows[i]["任务编码"] %>',
                            '<%=dt_delegtask.Rows[i]["父级编码"]%>','<%=ViewData["user_id"] %>')">代为审批</a>
                    </td>
                </tr>
                <%
                    }
                    }
                    else
                    { %>
                <tr>
                    <td colspan="0" style="text-align: center;">
                        当前无数据！
                    </td>
                </tr>
                <%} %>
            </tbody>
        </table>
    </div>
    <div id="pageLink">
        <%var pageInfo = ViewData["pageInfo"] as PagingInfo;%>
        <%if (pageInfo != null)
          {%>
        <%=Ajax.PageLinks(pageInfo, index => Url.Action("WFCurDelegTaskList", new
        {
            page = index,
            wfname = ViewData["searchtaskname_wfcurdelegtasklist"],
            stime = ViewData["searchstime_wfcurdelegtasklist"],
            etime = ViewData["searchetime_wfcurdelegtasklist"],
        }), new AjaxOptions { UpdateTargetId = "workarea-2-7" })%>
        <%} %>
    </div>
    <%} %>
</div>
